//done
package Server;

import java.awt.Rectangle;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

/**
 * @author ameer
 * @author waleed
 * @author bshara
 * @author kamil
 */

public class ServerStartWindow extends JFrame
{
	private JButton stopButton = null;
	private JLabel workingLabel = null;
	private int port;
	/**
	 * This is the default constructor
	 */
	public ServerStartWindow(int port) 
	{
		super();
		this.port = port;
		initialize();	
	}
	
	/**
	 * This method initializes ProductWindow
	 */
	private void initialize() 
	{	
		this.setBounds(390, 180, 370, 300);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setTitle("Welcome to CCRM Server");
		
		workingLabel  = new JLabel();
		workingLabel .setBounds(new Rectangle(62, 122, 280, 22));
		workingLabel .setText("Server is listening for connections on port "+port);
				
		getContentPane().setLayout(null);
		getContentPane().add(workingLabel,null);	
		getContentPane().add(getStopButton(),null);		
		
		JLabel label_1 = new JLabel("");
		label_1.setIcon(new ImageIcon(ServerStartWindow.class.getResource("/Pictures/server.png")));
		label_1.setBounds(145, 22, 158, 102);
		getContentPane().add(label_1);
		
		JLabel label = new JLabel("");
		label.setIcon(new ImageIcon(ServerStartWindow.class.getResource("/Pictures/bg.png")));
		label.setBounds(0, 0, 420, 300);
		getContentPane().add(label);
	}
	
	/**
	 * This method initializes SaveButton	
	 */
	public JButton getStopButton() 
	{
		if (stopButton == null) 
		{
			stopButton = new JButton();
			stopButton.setBounds(new Rectangle(86, 166, 172, 29));
			stopButton.setText("STOP");
			stopButton.addActionListener(new java.awt.event.ActionListener() 
			{
				public void actionPerformed(java.awt.event.ActionEvent e) 
				{
					System.exit(0);
				}					
			});						
		}
		return stopButton;
	}
}
